package com.hegaoye.mqhandler;

import lombok.extern.slf4j.Slf4j;
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class KafkaConsumer {

  @KafkaListener(topics = {"test", "test2"})
  public void consumer(ConsumerRecord<?, ?> consumerRecord) {
    // 判断是否为null
    log.info(">>>>>>>>>> record =" + consumerRecord.value());
    Object message = consumerRecord.value();
    log.info(">>>>>>>>接收消息message2 =" + message);
  }
}
